import { Controller, Get, Post, Body, Param } from '@nestjs/common';
import { RoleMenusService } from './role-menus.service';
import { CreateRoleMenuDto } from './dto/create-role-menu.dto';
import { UpdateRoleMenuDto } from './dto/update-role-menu.dto';
import { ApiOperation, ApiTags } from '@nestjs/swagger';

@ApiTags('角色菜单')
@Controller('role-menus')
export class RoleMenusController {
  constructor(private readonly roleMenusService: RoleMenusService) {}

  @ApiOperation({ summary: '创建角色菜单' })
  @Post()
  create(@Body() createRoleMenuDto: CreateRoleMenuDto) {
    return this.roleMenusService.create(createRoleMenuDto);
  }

  @ApiOperation({ summary: '查询所有角色菜单' })
  @Get('queryAll')
  findAll() {
    return this.roleMenusService.findAll();
  }

  @ApiOperation({ summary: '查询角色菜单' })
  @Get('query:id')
  findOne(@Param('id') id: string) {
    return this.roleMenusService.findOne(+id);
  }

  @ApiOperation({ summary: '编辑角色菜单' })
  @Post('update/:id')
  update(
    @Param('id') id: string,
    @Body() updateRoleMenuDto: UpdateRoleMenuDto,
  ) {
    return this.roleMenusService.update(+id, updateRoleMenuDto);
  }

  @ApiOperation({ summary: '删除角色菜单' })
  @Post('remove/:id')
  remove(@Param('id') id: string) {
    return this.roleMenusService.remove(+id);
  }
}
